#pragma once
#include "pch.h"
#include <afxsock.h>
#include <WinSock2.h>
#include <string>

#pragma comment(lib, "ws2_32.lib")

class ATLAS
{
private:

	SOCKET socket_fd = -1;

	bool isConnected = false;

	void ReviceMsg();

	std::string connectstring = "00200001006        00";
	std::string heart = "00209999001         00";
	std::string subscribestring = "006000080010        1201001310000000000000000000000000000001\r\n";


	std::string msg = "";

public:
	std::string ip = "127.0.0.1";
	int port = 8000;

public:

	ATLAS();

	bool ConnectServer(std::string ip = "127.0.0.1", int port = 8000);

	void Heart();

	bool Connecte();

	bool SendByte(char byteArray[], int dataLen) const;

	bool SendByteString2Byte(std::string msg) const;

	bool SendString2Byte(std::string msg) const;

	bool SendString(std::string msg) const;

	std::string GetData(float& angle, float& torque);

	bool IsConnected() const { return isConnected; }

};

